//项目根组件
//APP 引入到 index里 pulic/index.html(root)

import { useState } from 'react';
import Fn_useRef from './useRef';
import Wrap from './sonChildren';
import Text from './useContext';
import UseEffectFn from  './useEffect';
import HookFunction from '../src/hookFunction';



function App() {
  //调用useState添加一个状态变量
  //count 状态变量
  //setState 修改状态变量的方法
  const [count,setCount] = useState(0);

  //点击事件的回调

  const handClick = () =>{
    //作用： 1、用传入的新值修改count
    //    2、重新使用新的count渲染
    setCount(count + 1);
  }
  const [from,setFrom] = useState({name:'开发'});
  const handFrom = () =>{
    setFrom({
      ...from,
      name:'茳辞'
    })
  }
  return (
    <div className="App">
       <button onClick={handClick}>{count}</button>
       <button onClick={handFrom}>{from.name}</button>
       <Fn_useRef />
       <Wrap/>
       <Text />
       <UseEffectFn/>
       <HookFunction/>
    </div>
  );
}

export default App;
